<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::any('orm','StudentController@orm');

Route::any('student/student','StudentController@test');

Route::get('test','StudentController@test');

Route::get('student','StudentController@student');

Route::get('query1','StudentController@query1');



//新建控制器，显示视图
//Route::get('member/index','MemberController@index');
//Route::get('member/index',['uses'=>'MemberController@index']);
Route::get('member/index',[
	'uses'=>'MemberController@index',
	'as'=>'memberindex'
	]);



Route::get('/', function () {
    return view('welcome');          //这个对应得模板在"./resources/views/welcome.blade.php"

	// 写接口的话这样返回就是json数据
    // return [
    //     'message'=>"安装成功"
    // ]; 
});


//1、测试练习get请求路由
Route::get('test1',function(){
	return 'hello waittingWang!';
});

//2、测试练习post请求路由[注意：在浏览器中测试不了]
Route::post('test2',function(){
	return 'hello laravel!';
});

//3、测试练习多路由请求（match）
Route::match(['get','post'],'test3',function(){
	return 'match路由请求测试！';
});

//4、测试练习any任意请求路由
Route::any('test4',function(){
	return  'any!';
});

//5、路由参数
//>>>>指定参数
// Route::get('user/{id}',function($id){
// 	return 'user-id-'.$id;
// });

//>>>>自定义参数
// Route::get('user/{name?}',function($name=''){
// 	return 'user-name-'.$name;
// });

//>>>>默认参数
// Route::get('user/{name?}',function($name='waittingWang'){
// 	return 'user-name-'.$name;
// });

//>>>>正则匹配参数
// Route::get('user/{name?}',function($name='waittingWang'){
// 	return 'user-name-'.$name;
// })->where('name','[A-Za-z]+');


//6、路由别名
Route::get('user/u',['as'=>'u',function(){
	return route('u');
}]);


//7、路由群组
Route::group(['prefix'=>'member'],function(){

	Route::get('user/u',['as'=>'u',function(){
	     return route('u');
    }]);

    Route::any('test4',function(){
	     return  'member-any!';
    });

});

//8、路由中输出视图
Route::get('user',function(){
	return view('welcome');
});

